<?php 
namespace Admin\Controller;
//use Think\Controller;
use Tools\AdminController;
class GoodsController extends AdminController {
//	商品列表
	public function showlist(){
            $goodsModel = D('Goods')->order('goods_id')->select();
            
		$this->display();
	}
//	商品添加
	public function tianjia(){
            $goodsModel = new \Model\GoodsModel;
            if(!IS_POST){
                $cats = D('Cat')->field('cat_id,cat_name')->where('parent_id!=0')->select();
                $this->assign('cats',$cats);
                $this->display();
            }else{
//                $data = $goodsModel->create(I());
                var_dump(I());
                exit;
                    if($goodsModel->add(I())){
                        $this->redirect('showlist',array(),2,'添加成功');
                    }else{
                        $this->error('添加失败');
                    }
            }	
	}
//	修改商品
	public function xiugai(){
		$this->display();
	}
}